<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/vue/2.4.2/vue.js"></script>
    <script src="../../../dict.js"></script>
</head>
<body>
<div id="app">
    <p >{{fullName}}</p>
</div>
<script>

    Vue.config.devtools = true
    var vm = new Vue({
        el : "#app",
        data : {
            firstName: 'Foo',
            lastName: 'Bar',
            fullName: 'Foo Bar'
        },
        watch: {
            firstName: function (val) {
                this.fullName = val + ' ' + this.lastName
            },
            lastName: function (val) {
                this.fullName = this.firstName + ' ' + val
            }
        }
    })

   //本示例 请在开发者工具中使用vm实例改变属性值来测试
    //vm.lastName = '111'
</script>
</body>
</html>
